//
// Source resultCode recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.sdhs.system.syncdata.util;

import io.swagger.annotations.*;

import java.io.*;

@ApiModel("响应")
public class Result<T> implements Serializable {
    private static final long serialVersionUID = 1L;
//    @ApiModelProperty("编码：0表示成功，其他值表示失败")
//    private int resultCode = 0;
//    @ApiModelProperty("消息内容")
//    private String msg = "success";
    @ApiModelProperty("编码：0表示成功，其他值表示失败")
    private String resultCode = "0";
    @ApiModelProperty("消息内容")
    private String message = "success";
    @ApiModelProperty("随机码")
    private String bimRequestId;



    public Result() {
    }

    public Result<T> ok(String data) {
        this.setBimRequestId(data);
        return this;
    }

    public boolean success() {
        return this.resultCode == "0";
    }

//    public static <T> Result<T> success(String data) {
//        return (new Result()).ok(data);
//    }




//    public static <T> Result<T> badRequest(String msg, String resultCode) {
//        return (new Result()).error(resultCode, msg);
//    }

    public Result<T> error() {
        this.resultCode = "500";
        this.message = MessUtils.getMessage(this.resultCode);
        return this;
    }

    public Result<T> error(String resultCode) {
//        this.resultCode = resultCode;
        this.resultCode = "500";
        this.message = resultCode;
//        this.message = MessUtils.getMessage(this.resultCode);
        return this;
    }

    public Result<T> error(String resultCode,int flag) {
//        this.resultCode = resultCode;
        this.resultCode = "500";
        this.message=resultCode;
//        this.message = MessUtils.getMessage(this.resultCode);
        return this;
    }
    public Result<T> error(String resultCode,int flag,int code) {
//        this.resultCode = resultCode;
        this.resultCode = "50010";
        this.message=resultCode;
//        this.message = MessUtils.getMessage(this.resultCode);
        return this;
    }
    public Result<T> error(String resultCode, String msg) {
        this.resultCode = resultCode;
        this.message = msg;
        return this;
    }

//    public Result<T> error(String msg) {
//        this.resultCode = "500";
//        this.message = msg;
//        return this;
//    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getBimRequestId() {
        return bimRequestId;
    }

    public void setBimRequestId(String bimRequestId) {
        this.bimRequestId = bimRequestId;
    }

}
